home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1996 July / Macworld (1996-07).dmg / For your System Folder / Sound Manager 3.2a2 / SoundInput.a < prev    next >
Text File  |  1995-11-24  |  12KB  |  483 lines

  1. ;
  2. ;    File:        SoundInput.a
  3. ;
  4. ;    Contains:    Sound Input Interfaces.
  5. ;
  6. ;    Version:    ETO
  7. ;
  8. ;    DRI:        Jim Reekes
  9. ;
  10. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  11. ;                All rights reserved.
  12. ;
  13. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14. ;                stack.  Include the file and version information (from above)
  15. ;                in the problem description and send to:
  16. ;                    Internet:    apple.bugs@applelink.apple.com
  17. ;                    AppleLink:    APPLE.BUGS
  18. ;
  19. ;
  20.  
  21.     IF &TYPE('__SOUNDINPUT__') = 'UNDEFINED' THEN
  22. __SOUNDINPUT__ SET 1
  23.  
  24.  
  25.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  26.     include 'Types.a'
  27.     ENDIF
  28. ;        include 'ConditionalMacros.a'                                ;
  29.  
  30.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  31.     include 'AppleEvents.a'
  32.     ENDIF
  33. ;        include 'Errors.a'                                            ;
  34. ;        include 'Memory.a'                                            ;
  35. ;            include 'MixedMode.a'                                    ;
  36. ;        include 'OSUtils.a'                                        ;
  37. ;        include 'Events.a'                                            ;
  38. ;            include 'Quickdraw.a'                                    ;
  39. ;                include 'QuickdrawText.a'                            ;
  40. ;        include 'EPPC.a'                                            ;
  41. ;            include 'AppleTalk.a'                                    ;
  42. ;            include 'Files.a'                                        ;
  43. ;                include 'Finder.a'                                    ;
  44. ;            include 'PPCToolbox.a'                                    ;
  45. ;            include 'Processes.a'                                    ;
  46. ;        include 'Notification.a'                                    ;
  47.  
  48.     IF &TYPE('__WINDOWS__') = 'UNDEFINED' THEN
  49.     include 'Windows.a'
  50.     ENDIF
  51. ;        include 'Controls.a'                                        ;
  52. ;            include 'Menus.a'                                        ;
  53.  
  54.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  55.     include 'Dialogs.a'
  56.     ENDIF
  57. ;        include 'TextEdit.a'                                        ;
  58.  
  59.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  60.     include 'Files.a'
  61.     ENDIF
  62.  
  63.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  64.     include 'Sound.a'
  65.     ENDIF
  66. ;        include 'Components.a'                                        ;
  67.  
  68. ;
  69. ;                        * * *  N O T E  * * *
  70. ;
  71. ;    This file has been updated to include Sound Input Manager 1.1 interfaces.
  72. ;
  73. ;    Some of the Sound Input Manager 1.1 interfaces were not put into the InterfaceLib
  74. ;    that originally shipped with the PowerMacs. These missing functions and the
  75. ;    new 1.1 interfaces have been released in the SoundLib library for PowerPC
  76. ;    developers to link with. The runtime library for these functions are
  77. ;    installed by Sound Manager 3.2. The following functions are found in SoundLib.
  78. ;
  79. ;        ParseAIFFHeader(), ParseSndHeader()
  80. ;
  81. ;
  82.  
  83. siDeviceIsConnected                EQU        1                    ;input device is connected and ready for input
  84. siDeviceNotConnected            EQU        0                    ;input device is not connected
  85. siDontKnowIfConnected            EQU        -1                    ;can't tell if input device is connected
  86. siReadPermission                EQU        0                    ;permission passed to SPBOpenDevice
  87. siWritePermission                EQU        1                    ;permission passed to SPBOpenDevice
  88.  
  89. ;Info Selectors for Sound Input Drivers
  90. siActiveChannels                EQU        'chac'                ;active channels
  91. siActiveLevels                    EQU        'lmac'                ;active meter levels
  92. siAGCOnOff                        EQU        'agc '                ;automatic gain control state
  93. siAsync                            EQU        'asyn'                ;asynchronous capability
  94. siChannelAvailable                EQU        'chav'                ;number of channels available
  95. siCompressionAvailable            EQU        'cmav'                ;compression types available
  96. siCompressionFactor                EQU        'cmfa'                ;current compression factor
  97. siCompressionHeader                EQU        'cmhd'                ;return compression header
  98. siCompressionNames                EQU        'cnam'                ;compression type names available
  99. siCompressionType                EQU        'comp'                ;current compression type
  100. siContinuous                    EQU        'cont'                ;continous recording
  101. siDeviceBufferInfo                EQU        'dbin'                ;size of interrupt buffer
  102. siDeviceConnected                EQU        'dcon'                ;input device connection status
  103. siDeviceIcon                    EQU        'icon'                ;input device icon
  104. siDeviceName                    EQU        'name'                ;input device name
  105. siHardwareBusy                    EQU        'hwbs'                ;sound hardware is in use
  106. siInputGain                        EQU        'gain'                ;input gain
  107. siInputSource                    EQU        'sour'                ;input source selector
  108. siInputSourceNames                EQU        'snam'                ;input source names
  109. siLevelMeterOnOff                EQU        'lmet'                ;level meter state
  110. siModemGain                        EQU        'mgai'                ;modem input gain
  111. siNumberChannels                EQU        'chan'                ;current number of channels
  112. siOptionsDialog                    EQU        'optd'                ;display options dialog
  113. siPlayThruOnOff                    EQU        'plth'                ;playthrough state
  114. siRecordingQuality                EQU        'qual'                ;recording quality
  115. siSampleRate                    EQU        'srat'                ;current sample rate
  116. siSampleRateAvailable            EQU        'srav'                ;sample rates available
  117. siSampleSize                    EQU        'ssiz'                ;current sample size
  118. siSampleSizeAvailable            EQU        'ssav'                ;sample sizes available
  119. siSetupCDAudio                    EQU        'sucd'                ;setup sound hardware for CD audio
  120. siSetupModemAudio                EQU        'sumd'                ;setup sound hardware for modem audio
  121. siStereoInputGain                EQU        'sgai'                ;stereo input gain
  122. siTwosComplementOnOff            EQU        'twos'                ;two's complement state
  123. siVoxRecordInfo                    EQU        'voxr'                ;VOX record parameters
  124. siVoxStopInfo                    EQU        'voxs'                ;VOX stop parameters
  125. siCloseDriver                    EQU        'clos'                ;reserved for internal use only
  126. siInitializeDriver                EQU        'init'                ;reserved for internal use only
  127. siPauseRecording                EQU        'paus'                ;reserved for internal use only
  128. siUserInterruptProc                EQU        'user'                ;reserved for internal use only
  129. ;Qualities
  130. siCDQuality                        EQU        'cd  '                ;44.1kHz, stereo, 16 bit
  131. siBestQuality                    EQU        'best'                ;22kHz, mono, 8 bit
  132. siBetterQuality                    EQU        'betr'                ;22kHz, mono, MACE 3:1
  133. siGoodQuality                    EQU        'good'
  134.  
  135. ; typedef struct SPB         SPB, *SPBPtr
  136. ;user procedures called by sound input routines
  137. SPB                     RECORD    0
  138. inRefNum                 ds.l   1        ; offset: $0 (0)        ;reference number of sound input device
  139. count                     ds.l   1        ; offset: $4 (4)        ;number of bytes to record
  140. milliseconds             ds.l   1        ; offset: $8 (8)        ;number of milliseconds to record
  141. bufferLength             ds.l   1        ; offset: $C (12)        ;length of buffer in bytes
  142. bufferPtr                 ds.l   1        ; offset: $10 (16)        ;buffer to store sound data in
  143. completionRoutine         ds.l   1        ; offset: $14 (20)        ;completion routine
  144. interruptRoutine         ds.l   1        ; offset: $18 (24)        ;interrupt routine
  145. userLong                 ds.l   1        ; offset: $1C (28)        ;user-defined field
  146. error                     ds.w   1        ; offset: $20 (32)        ;error
  147. unused1                     ds.l   1        ; offset: $22 (34)        ;reserved - must be zero
  148. sizeof                     EQU *            ; size:   $26 (38)
  149.                         ENDR
  150.  
  151. ;
  152. ; pascal NumVersion SPBVersion(void)
  153. ;
  154.     IF ¬ GENERATINGCFM THEN
  155.         Macro
  156.         _SPBVersion
  157.             dc.w     $203C
  158.             dc.w     $0000
  159.             dc.w     $0014
  160.             dc.w     $A800
  161.         EndM
  162.     ELSE
  163.         IMPORT_CFM_FUNCTION    SPBVersion
  164.     ENDIF
  165.  
  166. ;
  167. ; pascal OSErr SndRecord(ModalFilterUPP filterProc, Point corner, OSType quality, SndListHandle *sndHandle)
  168. ;
  169.     IF ¬ GENERATINGCFM THEN
  170.         Macro
  171.         _SndRecord
  172.             dc.w     $203C
  173.             dc.w     $0804
  174.             dc.w     $0014
  175.             dc.w     $A800
  176.         EndM
  177.     ELSE
  178.         IMPORT_CFM_FUNCTION    SndRecord
  179.     ENDIF
  180.  
  181. ;
  182. ; pascal OSErr SndRecordToFile(ModalFilterUPP filterProc, Point corner, OSType quality, short fRefNum)
  183. ;
  184.     IF ¬ GENERATINGCFM THEN
  185.         Macro
  186.         _SndRecordToFile
  187.             dc.w     $203C
  188.             dc.w     $0708
  189.             dc.w     $0014
  190.             dc.w     $A800
  191.         EndM
  192.     ELSE
  193.         IMPORT_CFM_FUNCTION    SndRecordToFile
  194.     ENDIF
  195.  
  196. ;
  197. ; pascal OSErr SPBSignInDevice(short deviceRefNum, ConstStr255Param deviceName)
  198. ;
  199.     IF ¬ GENERATINGCFM THEN
  200.         Macro
  201.         _SPBSignInDevice
  202.             dc.w     $203C
  203.             dc.w     $030C
  204.             dc.w     $0014
  205.             dc.w     $A800
  206.         EndM
  207.     ELSE
  208.         IMPORT_CFM_FUNCTION    SPBSignInDevice
  209.     ENDIF
  210.  
  211. ;
  212. ; pascal OSErr SPBSignOutDevice(short deviceRefNum)
  213. ;
  214.     IF ¬ GENERATINGCFM THEN
  215.         Macro
  216.         _SPBSignOutDevice
  217.             dc.w     $203C
  218.             dc.w     $0110
  219.             dc.w     $0014
  220.             dc.w     $A800
  221.         EndM
  222.     ELSE
  223.         IMPORT_CFM_FUNCTION    SPBSignOutDevice
  224.     ENDIF
  225.  
  226. ;
  227. ; pascal OSErr SPBGetIndexedDevice(short count, Str255 deviceName, Handle *deviceIconHandle)
  228. ;
  229.     IF ¬ GENERATINGCFM THEN
  230.         Macro
  231.         _SPBGetIndexedDevice
  232.             dc.w     $203C
  233.             dc.w     $0514
  234.             dc.w     $0014
  235.             dc.w     $A800
  236.         EndM
  237.     ELSE
  238.         IMPORT_CFM_FUNCTION    SPBGetIndexedDevice
  239.     ENDIF
  240.  
  241. ;
  242. ; pascal OSErr SPBOpenDevice(ConstStr255Param deviceName, short permission, long *inRefNum)
  243. ;
  244.     IF ¬ GENERATINGCFM THEN
  245.         Macro
  246.         _SPBOpenDevice
  247.             dc.w     $203C
  248.             dc.w     $0518
  249.             dc.w     $0014
  250.             dc.w     $A800
  251.         EndM
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    SPBOpenDevice
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal OSErr SPBCloseDevice(long inRefNum)
  258. ;
  259.     IF ¬ GENERATINGCFM THEN
  260.         Macro
  261.         _SPBCloseDevice
  262.             dc.w     $203C
  263.             dc.w     $021C
  264.             dc.w     $0014
  265.             dc.w     $A800
  266.         EndM
  267.     ELSE
  268.         IMPORT_CFM_FUNCTION    SPBCloseDevice
  269.     ENDIF
  270.  
  271. ;
  272. ; pascal OSErr SPBRecord(SPBPtr inParamPtr, Boolean asynchFlag)
  273. ;
  274.     IF ¬ GENERATINGCFM THEN
  275.         Macro
  276.         _SPBRecord
  277.             dc.w     $203C
  278.             dc.w     $0320
  279.             dc.w     $0014
  280.             dc.w     $A800
  281.         EndM
  282.     ELSE
  283.         IMPORT_CFM_FUNCTION    SPBRecord
  284.     ENDIF
  285.  
  286. ;
  287. ; pascal OSErr SPBRecordToFile(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag)
  288. ;
  289.     IF ¬ GENERATINGCFM THEN
  290.         Macro
  291.         _SPBRecordToFile
  292.             dc.w     $203C
  293.             dc.w     $0424
  294.             dc.w     $0014
  295.             dc.w     $A800
  296.         EndM
  297.     ELSE
  298.         IMPORT_CFM_FUNCTION    SPBRecordToFile
  299.     ENDIF
  300.  
  301. ;
  302. ; pascal OSErr SPBPauseRecording(long inRefNum)
  303. ;
  304.     IF ¬ GENERATINGCFM THEN
  305.         Macro
  306.         _SPBPauseRecording
  307.             dc.w     $203C
  308.             dc.w     $0228
  309.             dc.w     $0014
  310.             dc.w     $A800
  311.         EndM
  312.     ELSE
  313.         IMPORT_CFM_FUNCTION    SPBPauseRecording
  314.     ENDIF
  315.  
  316. ;
  317. ; pascal OSErr SPBResumeRecording(long inRefNum)
  318. ;
  319.     IF ¬ GENERATINGCFM THEN
  320.         Macro
  321.         _SPBResumeRecording
  322.             dc.w     $203C
  323.             dc.w     $022C
  324.             dc.w     $0014
  325.             dc.w     $A800
  326.         EndM
  327.     ELSE
  328.         IMPORT_CFM_FUNCTION    SPBResumeRecording
  329.     ENDIF
  330.  
  331. ;
  332. ; pascal OSErr SPBStopRecording(long inRefNum)
  333. ;
  334.     IF ¬ GENERATINGCFM THEN
  335.         Macro
  336.         _SPBStopRecording
  337.             dc.w     $203C
  338.             dc.w     $0230
  339.             dc.w     $0014
  340.             dc.w     $A800
  341.         EndM
  342.     ELSE
  343.         IMPORT_CFM_FUNCTION    SPBStopRecording
  344.     ENDIF
  345.  
  346. ;
  347. ; pascal OSErr SPBGetRecordingStatus(long inRefNum, short *recordingStatus, short *meterLevel, unsigned long *totalSamplesToRecord, unsigned long *numberOfSamplesRecorded, unsigned long *totalMsecsToRecord, unsigned long *numberOfMsecsRecorded)
  348. ;
  349.     IF ¬ GENERATINGCFM THEN
  350.         Macro
  351.         _SPBGetRecordingStatus
  352.             dc.w     $203C
  353.             dc.w     $0E34
  354.             dc.w     $0014
  355.             dc.w     $A800
  356.         EndM
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION    SPBGetRecordingStatus
  359.     ENDIF
  360.  
  361. ;
  362. ; pascal OSErr SPBGetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  363. ;
  364.     IF ¬ GENERATINGCFM THEN
  365.         Macro
  366.         _SPBGetDeviceInfo
  367.             dc.w     $203C
  368.             dc.w     $0638
  369.             dc.w     $0014
  370.             dc.w     $A800
  371.         EndM
  372.     ELSE
  373.         IMPORT_CFM_FUNCTION    SPBGetDeviceInfo
  374.     ENDIF
  375.  
  376. ;
  377. ; pascal OSErr SPBSetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  378. ;
  379.     IF ¬ GENERATINGCFM THEN
  380.         Macro
  381.         _SPBSetDeviceInfo
  382.             dc.w     $203C
  383.             dc.w     $063C
  384.             dc.w     $0014
  385.             dc.w     $A800
  386.         EndM
  387.     ELSE
  388.         IMPORT_CFM_FUNCTION    SPBSetDeviceInfo
  389.     ENDIF
  390.  
  391. ;
  392. ; pascal OSErr SPBMillisecondsToBytes(long inRefNum, long *milliseconds)
  393. ;
  394.     IF ¬ GENERATINGCFM THEN
  395.         Macro
  396.         _SPBMillisecondsToBytes
  397.             dc.w     $203C
  398.             dc.w     $0440
  399.             dc.w     $0014
  400.             dc.w     $A800
  401.         EndM
  402.     ELSE
  403.         IMPORT_CFM_FUNCTION    SPBMillisecondsToBytes
  404.     ENDIF
  405.  
  406. ;
  407. ; pascal OSErr SPBBytesToMilliseconds(long inRefNum, long *byteCount)
  408. ;
  409.     IF ¬ GENERATINGCFM THEN
  410.         Macro
  411.         _SPBBytesToMilliseconds
  412.             dc.w     $203C
  413.             dc.w     $0444
  414.             dc.w     $0014
  415.             dc.w     $A800
  416.         EndM
  417.     ELSE
  418.         IMPORT_CFM_FUNCTION    SPBBytesToMilliseconds
  419.     ENDIF
  420.  
  421. ;
  422. ; pascal OSErr SetupSndHeader(SndListHandle sndHandle, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, short baseNote, unsigned long numBytes, short *headerLen)
  423. ;
  424.     IF ¬ GENERATINGCFM THEN
  425.         Macro
  426.         _SetupSndHeader
  427.             dc.w     $203C
  428.             dc.w     $0D48
  429.             dc.w     $0014
  430.             dc.w     $A800
  431.         EndM
  432.     ELSE
  433.         IMPORT_CFM_FUNCTION    SetupSndHeader
  434.     ENDIF
  435.  
  436. ;
  437. ; pascal OSErr SetupAIFFHeader(short fRefNum, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, unsigned long numBytes, unsigned long numFrames)
  438. ;
  439.     IF ¬ GENERATINGCFM THEN
  440.         Macro
  441.         _SetupAIFFHeader
  442.             dc.w     $203C
  443.             dc.w     $0B4C
  444.             dc.w     $0014
  445.             dc.w     $A800
  446.         EndM
  447.     ELSE
  448.         IMPORT_CFM_FUNCTION    SetupAIFFHeader
  449.     ENDIF
  450.  
  451. ; Sound Input Manager 1.1 and later calls 
  452. ;
  453. ; pascal OSErr ParseAIFFHeader(short fRefNum, SoundComponentData *sndInfo, unsigned long *numFrames, unsigned long *dataOffset)
  454. ;
  455.     IF ¬ GENERATINGCFM THEN
  456.         Macro
  457.         _ParseAIFFHeader
  458.             dc.w     $203C
  459.             dc.w     $0758
  460.             dc.w     $0014
  461.             dc.w     $A800
  462.         EndM
  463.     ELSE
  464.         IMPORT_CFM_FUNCTION    ParseAIFFHeader
  465.     ENDIF
  466.  
  467. ;
  468. ; pascal OSErr ParseSndHeader(SndListHandle sndHandle, SoundComponentData *sndInfo, unsigned long *numFrames, unsigned long *dataOffset)
  469. ;
  470.     IF ¬ GENERATINGCFM THEN
  471.         Macro
  472.         _ParseSndHeader
  473.             dc.w     $203C
  474.             dc.w     $085C
  475.             dc.w     $0014
  476.             dc.w     $A800
  477.         EndM
  478.     ELSE
  479.         IMPORT_CFM_FUNCTION    ParseSndHeader
  480.     ENDIF
  481.  
  482.     ENDIF ; __SOUNDINPUT__
  483.